package com.ydc.aop;

import com.ydc.vo.SysResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

//@ResponseBody     返回的是json格式
//@ControllerAdvice 拦截controller层通知
@RestControllerAdvice       //定义全局异常处理
public class AOPException {

    //实现原理 异常通知
    @ExceptionHandler({RuntimeException.class})
    public SysResult afterThrowing(Exception e){
        e.printStackTrace();
        return SysResult.fail();
    }
}
